Functions:

interfiles <- 'formatted_data/stream_co2'
# possible locations: 'dh', 'est_louis', 'fool', 'lexen'
year <- '2021'

co2_2021 <- opn_concat_2021(interfiles, year)%>%
  select(datetime, year, shed, location, co2_ppm) 

co2_2021$shed <- as.factor(co2_2021$shed)
co2_2021$location <- as.factor(co2_2021$location)

co2_2021$cut <- NULL
co2_2021$cut<-ifelse(co2_2021$shed== 'dh'|co2_2021$shed == 'fc','cut','uncut')
plot_subset <- co2_2021[co2_2021$shed == 'fc',]

ggplot(plot_subset, aes(datetime, co2_ppm, color = location)) + 
   geom_line() + 
   xlab('Date') +
   ylab('CO2 (ppm)') + 
   theme_classic() +
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

#ggplotly(co2plot)
plot_subset <- co2_2021[co2_2021$shed == 'lexen',]

ggplot(plot_subset, aes(datetime, co2_ppm, color = location)) + 
   geom_line() + 
   xlab('Date') +
   ylab('CO2 (ppm)') + 
   theme_classic() +
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

#ggplotly(co2plot)
plot_subset <- co2_2021[co2_2021$shed == 'dh',]

ggplot(plot_subset, aes(datetime, co2_ppm, color = location)) + 
   geom_line() + 
   xlab('Date') +
   ylab('CO2 (ppm)') + 
   theme_classic() +
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

#ggplotly(co2plot)
plot_subset <- subset(co2_2021, datetime >= '2021-08-15 20:00:00')

co2plot <- ggplot(plot_subset, aes(datetime, co2_ppm, color = cut)) + 
   geom_point() + 
   xlab('Date') +
   ylab('CO2 (ppm)') + 
   theme_classic() +
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

ggplotly(co2plot)